<div ng-controller="StoreCtrl" ng-init="attachMiniapp()" class="sui-form form-horizontal">
    <ul class="sui-breadcrumb">
        <li><a href="#/store/config?store_id={{store_id}}">{{'store'|translate}}</a></li>
        <li>
            {{wxappname}}
        </li>
        <li class="active"> 关联小程序 </li>
        <span class="sui-form sui-form pull-right"> 
        </span>
    </ul>
    <div>
        <p>未关联的小程序列表：</p>
        <table class="sui-table table-bordered">
            <thead>
                <tr>
                    <th>{{'logo'|translate}}</th>
                    <th>{{'AppID'|translate}}</th>
                    <th>{{'小程序名'|translate}}</th>
                    <th>{{'操作'|translate}}</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="app in allauthrizedApp" ng-if="ifAuthrized(app.nick_name)">
                    <td>
                        <img ng-src="{{logoUrl(app.avartar_url)}}" style="width: 60px;" />
                    </td>
                    <td>
                        {{app.app_id}}
                    </td>
                    <td>
                        {{app.nick_name}}
                    </td>
                    <td>
                        <button class="sui-btn btn-primary" ng-click="linkApp(app.app_id)">关联</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div>
        <p>已关联的小程序列表：</p>
        <table class="sui-table table-bordered">
            <thead>
                <tr>
                    <th>{{'logo'|translate}}</th>
                    <th>{{'原始ID'|translate}}</th>
                    <th>{{'小程序名'|translate}}</th>
                    <th>{{'email'|translate}}</th>
                    <th>{{'操作'|translate}}</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="app in attachedapps">
                    <td>
                        <img ng-src="{{logoUrl(app.headimg_url)}}" style="width: 60px;" />
                    </td>
                    <td>
                        {{app.username}}
                    </td>
                    <td>
                        {{app.nickname}}
                    </td>
                    <td>
                        {{app.email}}
                    </td>
                    <td>
                        <button class="sui-btn btn-danger" ng-click="unlinkApp(app.username)">解除</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>